<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="java.text.DecimalFormat" %>
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>书香阁 - 支付成功</title>
    <style>
        :root {
            --primary-color: #8d6e63;
            --light-gray: #f5f5f5;
            --dark-gray: #5a3921;
            --text-color: #333;
            --border-color: #d7ccc8;
            --success-color: #388e3c;
        }
        
        body {
            font-family: 'Arial', sans-serif;
            margin: 0;
            padding: 0;
            background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), 
                        url('https://images.unsplash.com/photo-1507842217343-583bb7270b66?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80') no-repeat center center fixed;
            background-size: cover;
            color: var(--text-color);
        }
        
        .container {
            max-width: 800px;
            margin: 30px auto;
            background: rgba(255, 255, 255, 0.95);
            padding: 40px;
            border-radius: 10px;
            box-shadow: 0 10px 25px rgba(0,0,0,0.2);
            backdrop-filter: blur(5px);
            animation: fadeIn 0.5s ease-in-out;
            text-align: center;
        }
        
        @keyframes fadeIn {
            from { opacity: 0; transform: translateY(-20px); }
            to { opacity: 1; transform: translateY(0); }
        }
        
        h1 {
            color: var(--success-color);
            margin-bottom: 30px;
            padding-bottom: 15px;
            border-bottom: 2px solid var(--primary-color);
        }
        
        .success-icon {
            font-size: 80px;
            color: var(--success-color);
            margin-bottom: 20px;
            animation: bounce 1s ease infinite alternate;
        }
        
        @keyframes bounce {
            from { transform: translateY(0); }
            to { transform: translateY(-10px); }
        }
        
        .success-message {
            font-size: 18px;
            color: var(--dark-gray);
            margin-bottom: 30px;
        }
        
        .order-info {
            margin: 30px 0;
            text-align: left;
            padding: 25px;
            background-color: rgba(141, 110, 99, 0.05);
            border-radius: 8px;
            border-left: 4px solid var(--success-color);
        }
        
        .info-item {
            margin: 15px 0;
            display: flex;
            align-items: center;
        }
        
        .info-item strong {
            min-width: 100px;
            color: var(--dark-gray);
        }
        
        .btn {
            background-color: var(--success-color);
            color: white;
            padding: 12px 25px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 16px;
            text-decoration: none;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            transition: all 0.3s;
            margin-top: 30px;
        }
        
        .btn:hover {
            background-color: #2e7d32;
            transform: translateY(-2px);
            box-shadow: 0 4px 8px rgba(0,0,0,0.1);
        }
        
        .delivery-icon {
            font-size: 50px;
            color: var(--primary-color);
            margin: 20px 0;
        }
        
        .thank-you {
            font-style: italic;
            color: var(--primary-color);
            margin-top: 20px;
        }
        
        @media (max-width: 768px) {
            .container {
                padding: 25px;
            }
            
            .info-item {
                flex-direction: column;
                align-items: flex-start;
            }
            
            .info-item strong {
                margin-bottom: 5px;
            }
        }
    </style>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
</head>
<body>
    <div class="container">
        <div class="success-icon">
            <i class="fas fa-check-circle"></i>
        </div>
        <h1>支付成功！</h1>
        <p class="success-message">您的订单已支付成功，我们将尽快为您处理</p>
        
        <div class="delivery-icon">
            <i class="fas fa-truck"></i>
        </div>
        
        <div class="order-info">
            <%
                String orderId = (String) session.getAttribute("orderId");
                Double orderAmount = (Double) session.getAttribute("orderAmount");
                String[] shippingInfo = (String[]) session.getAttribute("shippingInfo");
            %>
            <div class="info-item">
                <strong><i class="fas fa-hashtag"></i> 订单编号：</strong> 
                <span><%=orderId%></span>
            </div>
            <div class="info-item">
                <strong><i class="fas fa-money-bill-wave"></i> 支付金额：</strong> 
                <span>¥<%=new DecimalFormat("0.00").format(orderAmount)%></span>
            </div>
            <% if (shippingInfo != null && shippingInfo.length >= 3) { %>
                <div class="info-item">
                    <strong><i class="fas fa-user"></i> 收货人：</strong> 
                    <span><%=shippingInfo[0]%></span>
                </div>
                <div class="info-item">
                    <strong><i class="fas fa-phone"></i> 联系电话：</strong> 
                    <span><%=shippingInfo[1]%></span>
                </div>
                <div class="info-item">
                    <strong><i class="fas fa-map-marker-alt"></i> 收货地址：</strong> 
                    <span><%=shippingInfo[2]%></span>
                </div>
            <% } %>
        </div>
        
        <p class="thank-you">感谢您的购买，欢迎再次光临书香阁！</p>
        
        <a href="list.jsp" class="btn">
            <i class="fas fa-book"></i> 继续选购
        </a>
    </div>
</body>
</html>